package route

import (
	"gq_volunteer_platform/controller/wxapi"
	"gq_volunteer_platform/controller/wxapi/activity"
	"gq_volunteer_platform/controller/wxapi/news"
	"gq_volunteer_platform/controller/wxapi/qr_code"

	"gq_volunteer_platform/controller/wxapi/help_request"
	"gq_volunteer_platform/controller/wxapi/message"
	"gq_volunteer_platform/controller/wxapi/organization"
	"gq_volunteer_platform/controller/wxapi/upload"
	"gq_volunteer_platform/controller/wxapi/user"
	"gq_volunteer_platform/middleware"

	"github.com/gin-gonic/gin"
)

func Wxapi(router *gin.Engine) {
	// 前台api接口
	wxapiGroup := router.Group("wxapi")
	{
		wxapiGroup.POST("user/Code2token", user.Code2token)

		newsGroup := wxapiGroup.Group("news")
		{
			newsGroup.GET("CategoryList", news.CategoryList)
			newsGroup.GET("List", news.List)
			newsGroup.GET("Detail", news.Detail)
		}

		wxapiGroup.GET("activity/List", activity.List)
		wxapiGroup.GET("activity/AllTypeList", activity.AllTypeList) // 获取所有活动类型列表

		organizationGroup := wxapiGroup.Group("organization")
		{
			organizationGroup.GET("List", organization.List)
			organizationGroup.GET("Detail", organization.Detail)
			organizationGroup.GET("Map", organization.Map)
		}

		message_Group := wxapiGroup.Group("message")
		{
			message_Group.GET("Test", message.Test)
			message_Group.POST("Index", message.Index)
		}

		// ============================== 登录验证分割线（下面的接口会被验证） ==============================
		wxapiGroup.Use(middleware.Wxapi)

		// 文件上传接口
		wxapiGroup.POST("upload/Upload", upload.Upload)

		// test
		wxapiGroup.GET("Test", wxapi.Test)
		wxapiGroup.GET("Test1", wxapi.Test1)

		wxapiUserGroup := wxapiGroup.Group("user")
		{
			wxapiUserGroup.GET("LoginBindAdmin", user.LoginBindAdmin)

			wxapiUserGroup.GET("Info", user.Info)
			wxapiUserGroup.GET("ServiceMobile", user.ServiceMobile)
			wxapiUserGroup.POST("Edit", user.Edit)
			wxapiUserGroup.POST("EditAndApply", user.EditAndApply)
			wxapiUserGroup.POST("ChangeOrganization", user.ChangeOrganization)
			wxapiUserGroup.POST("Exist", user.Exist)

			wxapiUserGroup.GET("MyActivityList", user.MyActivityList)
			wxapiUserGroup.GET("MyPointRecordList", user.MyPointRecordList)

			wxapiUserGroup.GET("ChangeStatus", user.ChangeStatus)
			wxapiUserGroup.POST("BindAdmin", user.BindAdmin)
			wxapiUserGroup.POST("QrCodeLoginConfirm", user.QrCodeLoginConfirm)
		}

		activityGroup := wxapiGroup.Group("activity")
		{

			activityGroup.GET("Detail", activity.Detail) // 获取个人信息
			activityGroup.POST("JoinApply", activity.JoinApply)
			activityGroup.POST("ExitApply", activity.ExitApply)
			activityGroup.POST("Sign", activity.Sign)
		}

		help_requestGroup := wxapiGroup.Group("help_request")
		{
			help_requestGroup.GET("MyList", help_request.MyList) // 获取个人信息
			help_requestGroup.POST("HelpRequest", help_request.HelpRequest)
		}

		qr_codeGroup := wxapiGroup.Group("qr_code")
		{
			qr_codeGroup.GET("ShareQRCode", qr_code.ShareQRCode) // 获取个人信息
		}

	}
	//
}
